more refactoring, long methods reduced in size where possible