More complex version, may be useful later
More bugfixes