prettify and cleanup code