Refactoring and cleanup. Building examples added.