Fixing bugs and moved implementation to use generic Object