Refactored and removed not nescecary code.