fixed some type errors and stated renaming some methods for readability