Code Cleanup and Rebuild Layout