.get() is not needed. Also I see a lot of nested 'if' with some complex conditions inside, could you please create some nicely-named boolean variables and use them to make it a bit clearer?