refactor code; add sfinder function and system tests for