cleaned up / refactored my hack code from last night