Changed macro definitions to fit better. Added modules support