Reverted the latest chenges. Need a more organized refactoring approach.