Cleaned up code and removed unnecessary fields to reduce memory complexity