Bugs fixed. Added copyrights