Quality function now includes +1 for maximum at the boundary. Added support for silent, stop at 2048 and test mode