Fix warnings

Eliminating unused parameters, declare them as unused, fixes some castings and putting keywords at the right place.