Adding some comments and fixing the open elif statement