refactor (in progress)