refactored for last time