Format code + adding intval in query.
Minor - fixing warnings + format code.