more code prettification and merging