Small fixes and a more flexible approach