first working version of beauty calculation