Cleaned up code warnings, removed some redundant code