Code refactored out and enhanced design