refactored allot of code.