Fix for duplicate declarations & misc

Handles duplicate declarations better (hopefully)
Moved binding to separate method