Edited controller so that it returns json