Fixed indentation and bugs