Code cleanup and Neos compatibility