Added the getLastId() function.

Also fixed tabbing.