basic functionality working. not certain if resource deallocation works correctly