refactored entire project