code cleanup, some doc added, etc..