Visual basic commonly used algorithm