fixed indention issue
Added extra param checking