Handles genus 0 and 1 cases. Genus 2 needs additional work.