Tidying up and added API for users pages