scripts by fusionjack with some customizations by me