added some functionality that still needs to be refactored