Changed rating function, demo

Rating function has been updated.
Finished demo.