cleanup code and layout