Extracted block placement code and added some error logging. Fixes #46