Fixed syntax error

Fixed syntax error caused by the absence of a right curly brace
Beautifying code

Refactoring code to make it more readable