extracted a method, renamed some things