Reverted issues and cleaned code