fixed indentation
added if/else clause