Fixes #1. Created a mean function