Improved building.

Still has issues, though. Please merge anyway.