Cleaned up code layout