LAST REV - FINISHED/ bugs fixed