refactored bad code, since it is actually being used :)