Removed duplicate code portions