Removed typeof, minor modifications