General code cleanup

...some speed improvement