refactored FTW :)