Move anonymous class to the top, add documentation