Change API to return floating point median

Transferred casting of stats to template and added documentation to stats model. 
Should take care of #248