Fix intendation and logic