Fixed minor issues and added necessary API