Fixed some technical problems as suggested by Wouter