fixed dead code
fixed bad integer conversion
fixed NULL dereferencing
splitted front page into multiple sub-pages