fixed some referencing errors, updated some code