reorganiced code/documentation to a more logical order for better reading