Added some tag functionality, refactored classes