Cleaned up sources, fixed #380.