layout improvements and code cleanup