Bug fix + code cleanup

servlet and code cleanup, read Facebook for more details