Added a boolean variable to check the owner status and pass it to javascript. Also indented some of the code.