improve coding style
improve docblocks
use uppercase for SQL syntax