Split up some functions to make way for precise auto-positioning
Note a bug
Add missing start pattern for heredocs
Auto-locate closest pattern