adding core logic from initial implementation, along with new classes to be used later
adding core logic from initial implementation, along with new classes to be used later