Fixes indentation and adds hasOwnProperty check