Removed duplicating code