refactored and splitting files webapp