as a general notice: please use more empty spaces if possible(especially this code lacks blank lines). it's hard to read code without them.
http://programmers.stackexchange.com/questions/17305/how-do-you-use-blank-lines-in-your-code