added epsilon as a parameter