changed guardFunc signature - now passes source and target states. More documentation improvements, started with JSDoc inline documentation.