removed call to function twice
changed indentation as suggested