Better comments
Added dynamic element test
More modular approach and various minor changes