some labels and gotos added, check if it's faster