Added tests. Fixed functions class restrictions.