added Goal class and some other functions