Added a test case and fixed indentation bug