added support for assignment, fix bug bug, clean up and added comments