1. This method is so complex that it needs a javadoc comment