finished popeye refactoring