Fixed all code. Tested and works