Refactoring

Getting rid off duplicate codes that is unnecessary.