partial refactor 05/28/13