License header was updated and several bugs were fixed