defining methods to compute result