Added documentation & subroutines