Refactored a bunch and added delete functionality.