Almost finished insert and getHandle methods.