Clean up and follow code conventions