Implemented assignment functions similar to the example
Added some comments