Code cleanup and more specs