added more functionality
added some functionality and refactored some insert queries