Moved some functions to theme since rating is a global action