I've incorporated the discussed changes into the original post. Feel free to check it out.