added brute force search to optimise constants