correct prototypes
use const qualifier where appropriate