fix indentation and add unit testing