added argument support, moved init to function, improved clarity