fixed some minor issues and referenced source