Adding output type and bug fixes