build steps, revised error handling and code refactoring